const auth_url = 'http://127.0.0.1:8085/oauth/authorize';
const clientId = 'self_app';
const scope = 'user kf ad sa';
const redirect_url = 'http://127.0.0.1:9091/auth/code';

class HttpUtil {
  static getQueryString(name) {
    let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    let r = window.location.search.substr(1).match(reg);
    return r !== null ? unescape(r[2]) : undefined
  }

  static redirectAuth() {
    const url = `${auth_url}?response_type=code&client_id=${clientId}&scope=${scope}&redirect_uri=${redirect_url}`;
    window.location.href = decodeURI(url)
  }
}

export default new HttpUtil();
